import React,{useEffect,useState} from "react";
import {TestApi} from "@/api"


function  userInput (){
    const [value, serValue] = useState("");

    const onChange = (e)=>{
        serValue(e.target.value);
    }
    return {
        value,
        onChange
    }

 }


const homeIndex = () => {

    const fetchData = async () => {
        console.log(import.meta.env.VITE_SOME_KEY);

        TestApi.getVertical()
        .catch(err=>console.log(err))
        .then(res=>{
            console.log("结果===",res);
        })
    };

    useEffect(()=>{
        // fetchData();
    },[])

    const userName = userInput();
    const userPassword = userInput();

    userPassword.onChange = (e)=>{
        console.log('okok');
    }

    return (
        <div>
            homeIndex 页面：<br /><br />

                userName:  {userName.value}
                <input type="text" {...userName} /><br /><br />

                password:  {userPassword.value}
                <input type="text" value={userPassword.value} onChange={userPassword.onChange} />


        </div>
    )
}

export default homeIndex